<include file="Public/header" />
<title>我的桌面</title>
</head>
<body>
<div class="pd-20">

		<table class="table table-border table-bordered table-hover table-bg" style="margin-top:20px;">
		<thead>
			<tr>
				<th scope="col" colspan="27">产品列表</th>
			</tr>
			<tr class="text-c">
				<th width="40">ID</th>
				<th width="40">单号</th>
				<th width="40">申请部门</th>
				<th width="100">批次</th>
				<th width="40">申请人</th>
				<th width="40">制单人</th>
				<th width="40">入库仓库</th>
				<th width="40">产品名称</th>
				<th width="40">产品规格</th>
				<th width="40">料号</th>
				<th width="40">产品编码</th>
				<th width="40">计划数量</th>
				<th width="80">实收到货</th>
				<th width="40">主单位</th>
				<th width="40">生产周期要求</th>
				<th width="40">申请摘要</th>
				<th width="40">备注</th>
				<th width="40">操作</th>
			</tr>
		</thead>
		<tbody>
			<tr class="text-c">
				<td><{$detail.id}><input type="hidden"   name="list_id" value="<{$detail.id}>" ></td>
				<td><{$detail.purchasing_no}></td>
				<td>
					<volist name="section_list" id="vo">
							<if condition="$vo['no'] eq $detail['section_no']"><{$vo.name}></if>
						</volist>
				</td>
				<td><{$detail.batch_no}></td>
				<td>
					<volist name="personnel_list" id="vo">
							<if condition="$vo['no'] eq $detail['people_purchasing_no']"><{$vo.name}></if>
						</volist>
				</td>
				<td>
					<volist name="personnel_list" id="vo">
								<if condition="$vo['no'] eq $detail['people_make_no']"><{$vo.name}></if>
							</volist>
				</td>
				<td>
					<volist name="warehouse_list" id="vo">
								<if condition="$vo['warehouse_code'] eq $detail['inbound_warehouse_code']"><{$vo.name}></if>
							</volist>
				</td>
				<td><{$detail.pro_name}></td>
				<td><{$detail.pro_spec}></td>
				<td><{$detail.source_no}></td>
				<td><{$detail.pro_no}></td>
				<td><{$detail.pro_num_plan}></td>
				<td>
					<span style="background-color: #a00; color:#fff; padding:2px 6px;">WMS件数:<{$detail.is_back_count}></span><BR><span style="background-color: #a00; color:#fff; padding:2px 6px;">ERP件数:<{$detail.back_count}></span>
				</td>
				<td>
				<volist name="unit_list" id="vo">
					<if condition="$vo['unit_no'] eq $detail['unit1']"><{$vo.unit_name}></if>
				</volist>
				</td>
				<td><{$detail.product_weeks}></td>
				<td><{$detail.product_marks}></td>
	
				<td><{$detail.mark}></td>
				<td>
				
				<if condition="$detail.is_back eq 0">
					暂无
				<elseif condition="$detail.is_back eq 1"/>
					<a style="text-decoration:none" class="ml-5 label label-success radius" onClick="detailBack('<{$detail.id}>',1)" href="javascript:;">返回实际发货数量</a>
				<else/>
					<if condition="$detail['is_back_count']-$detail['back_count'] eq 0">
						<empty name="detail['act_count']">
							<a style="text-decoration:none" class="ml-5 label label-success radius" onClick="lastSure('<{$detail.id}>',1)" href="javascript:;">最终确认</a>
						<else/>
							<a style="text-decoration:none" class="ml-5 label label-success radius" href="javascript:;">已确认</a>
						</empty>
					<else/>
						<a style="text-decoration:none" class="ml-5 label label-success radius" onClick="detailBack('<{$detail.id}>',1)" href="javascript:;">返回实际发货数量</a>
					</if>
				</if>
				</td>
			</tr>
			<volist name="byproduct_list" id="vs">
				<tr class="text-c">
				<td><{$vs.id}>副<input type="hidden" name="list_id" value="<{$vs.id}>" ></td>
				<td><{$detail.purchasing_no}></td>
				<td>
					<volist name="section_list" id="vo">
						<if condition="$vo['no'] eq $detail['section_no']"><{$vo.name}></if>
					</volist>
				</td>
				<td><{$detail.batch_no}></td>
				<td>
					<volist name="personnel_list" id="vo">
						<if condition="$vo['no'] eq $detail['people_purchasing_no']"><{$vo.name}></if>
					</volist>
				</td>
				<td>
							<volist name="personnel_list" id="vo">
								<if condition="$vo['no'] eq $detail['people_make_no']"><{$vo.name}></if>
							</volist>
				</td>
				<td>
							<volist name="warehouse_list" id="vo">
								<if condition="$vo['warehouse_code'] eq $detail['inbound_warehouse_code']"><{$vo.name}></if>
							</volist>
				</td>
				<td><{$vs.pro_name}></td>
				<td><{$vs.pro_spec}></td>
				<td><{$vs.source_no}></td>
				<td><{$vs.pro_no}></td>
				<td><{$vs.pro_num_plan}></td>
				<td>
					<span style="background-color: #a00; color:#fff; padding:2px 6px;">WMS件数:<{$vs.is_back_count}></span><BR><span style="background-color: #a00; color:#fff; padding:2px 6px;">ERP件数:<{$vs.back_count}></span>
				</td>
				<td>
				<volist name="unit_list" id="vo">
									<if condition="$vo['unit_no'] eq $vs['unit1']"><{$vo.unit_name}></if>
								</volist>
				</td>
				<td><{$vs.product_weeks}></td>
				<td><{$vs.product_marks}></td>
				<td><{$vs.mark}></td>
				<td>
				<if condition="$vs.is_back eq 0">
					暂无
				<elseif condition="$vs.is_back eq 1"/>
					<a style="text-decoration:none" class="ml-5 label label-success radius" onClick="detailBack('<{$vs.id}>',1)" href="javascript:;">返回实际发货数量</a>
				<else/>
					<if condition="$vs['is_back_count']-$vs['back_count'] eq 0">
						<empty name="vs['act_count']">
							<a style="text-decoration:none" class="ml-5 label label-success radius" onClick="lastSure('<{$vs.id}>',1)" href="javascript:;">最终确认</a>
						<else/>
							<a style="text-decoration:none" class="ml-5 label label-success radius" href="javascript:;">已确认</a>
						</empty>
					<else/>
						<a style="text-decoration:none" class="ml-5 label label-success radius" onClick="detailBack('<{$vs.id}>',1)" href="javascript:;">返回实际发货数量</a>
					</if>
				</if>
				</td>
			</tr>
			</volist>
		</tbody>
	</table>
	<input type="button" class="btn btn-primary radius mt" id="pedit" value="修改">
<div class="pages">
<{$page}>
</div>
</div>
<include file="Public/footer" />
<include file="Public/footer_js" />
<script>
	    function detailBack(id,sta){
            if(isNaN(id)){
                layer.msg('操作有误');
                return false;
            }
            layer.prompt({title: '请输入该商品的实际件数', formType: 0}, function(text, index){
                if(isNaN(text)){
                    layer.msg('操作有误');
                    return false;
                }
                $.post('__MODULE__/Productorder/detailBack',{
                    id:id,
					cate:'PRO',
					sta:sta,
                    count:text,
                },function (msg){
                    layer.msg(msg.data);
                    if(msg.flag==1){
                        setTimeout(function (){
                            location.reload();
                        },800);
                    }
                },'json');
            });
        }
        function lastSure(id,sta){
            layer.confirm('您确定要确认嘛？', {
                btn: ['确认','取消'] //按钮
            }, function(){
                $.post('__MODULE__/Productorder/lastSure',{
                    id:id,
					cate:'PRO',
					sta:sta
                },function (msg){
                    layer.msg(msg.data);
                    if(msg.flag==1){
                        setTimeout(function (){
                            location.reload();
                        },800);
                    }
                },'json');
            });
        }

</script>
</body>
</html>
</html>